#ifndef PORTLAN_H
#define PORTLAN_H
#include "porttestdll_global.h"
#include <QHostAddress>
#include <QtNetwork>
#include "PortType.h"

class CPortLan : public CPortType{
	Q_OBJECT
public:
	CPortLan(CTestResult &testResultTemp);
	~CPortLan(void);
private:
	CPortLan(void);
private slots:
	void onReadyReadTcp();
	void onReadyReadUdp();
	void readPingResult();
public:
	QBool writeIoVectorTcp();
	QBool writeIoVectorUdp();
    QBool SetIOs(QDomElement &dom);
	QBool RunTest();
	EProtocol GetEProtocol(){
		return protocol;
	}
private:
	QBool checkSrcIp(const QHostAddress &srcIpPar);
	QBool RunTestTcp();
	QBool RunTestUdp();
	QBool RunTestPing();
public:
	QUdpSocket		*m_udp;
	QTcpSocket		*m_tcp;
	QHostAddress	src_ip;		//="127.0.0.1"
	quint16			src_port;	//="1667"
	QHostAddress	des_ip;		//="127.0.0.1"
	quint16			des_port;	//="1667"
	EProtocol		protocol;	//="TCP"
	QBool			bPingResult;
	QString			strPingCmd;
};
#endif
